package com.chukun.concurrency.singleton;

import com.chukun.concurrency.annotations.UnThreadSafe;

/**
 * 使用懒汉式创建单例对象,会有线程安全的问题
 */
@UnThreadSafe
public class SingletonBuilder1 {

    private static SingletonBuilder1 instance;
    private SingletonBuilder1(){}

    public static SingletonBuilder1 getInstance(){
        if(instance==null){
            instance = new SingletonBuilder1();
        }
        return instance;
    }
}
